<?php
/**
 * Created by PhpStorm.
 * User: limi
 * Date: 2018-5-23
 * Time: 11:42
 */

/**
 * @param \parameters\Parameters $params
 */
function testParamValid($params)
{
    $params = new \parameters\Parameters([

    ]);
    $params->addP
}
function oneFunctionCall()
{
    $params = new \liyuze\Parameters\Parameters([
        'name' => $name,
        'title' => $age,
        'sex' => $sex,
    ]);
    $params->rules = [
        'age' => [
            'require',
            ['int', 'max' =>  100, 'min' => 18]
        ]
    ];
    $params->oneFunction($params);
}


function oneFunction($params)
{
    $params->rules = [
        'age' => [
            'require',
            ['int', 'max' =>  100, 'min' => 18]
        ]
    ];
    $params->validate();
}

function a($name, $age, $sex, $teacher_id)
{
    $params = new \liyuze\parameters\Parameters([
        'name' => [$name, ['required', 'string']],
        'age' => [$age, [
            'required',
            'number', 'min' => 0, 'max' => 100
        ]],
        'sex' => [$sex, ['required', 'in', 'eum' => [0,1]],
        'teacher_id' => [$teacher_id, ['required', 'number', function($param){

        }, [$this, 'validateor2']]], ['teacher_id']]
    ]);
    $params->rules = [
        'age' => [
            'require',
            ['int', 'max' =>  100, 'min' => 18]
        ]
    ];
    $params->validate();
}

function validateor2($param){}

//挂载
function a()
{
    $teacher_info = $




}


function b($params) {

    $teacher_info = $params->teacher_id->mounts['info'];
    //指定参数为 teacher_id 类型
    //由此类型可以获取到的对象
    //该对象只需要获取一次，再次获取直接返回。
}

